#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct Student{
	char id[30];
	char name[30];
	int s1;
	int s2;
	int s3;
}student;
int display(student* a,int order,int persons);
int main()
{
	student a[130];
	int n,order,persons=0;
	scanf("%d",&n);
	while(n--)
	{
		scanf("%d",&order);
		persons=display(a,order,persons);
	}
	return 0;
}
int display(student*a,int order,int persons)
{
	int math,english,computer;
	char midid[30],midname[30];
	double average;
	if(order==1)
	{
		scanf("%s %s %d %d %d",midid,midname,&math,&english,&computer);
		for(int i=0;i<persons;i++)
		{
			if(strcmp(a[i].id,midid)==0)
			{
				printf("Students already exist\n");
				return (persons);
			}
		} 
		strcpy(a[persons].id,midid);
		strcpy(a[persons].name,midname);
		a[persons].s1=math;
		a[persons].s2=english;
		a[persons].s3=computer;
		persons++;
		printf("Add success\n");
		return(persons);
	}
	else if(order==2)
	{
		scanf("%s",midid);
		for(int i=0;i<persons;i++)
		{
			if(strcmp(a[i].id,midid)==0)
			{
				for(int j=i;j<persons;j++)
					a[j]=a[j+1];
				printf("Delete success\n");
				persons--;
				return(persons);
			}
		}
		printf("Students do not exist\n");
		return(persons);
	}
	else if(order==3)
	{
		scanf("%s %d %d %d",midid,&math,&english,&computer);
		for(int i=0;i<persons;i++)
		{
			if(strcmp(a[i].id,midid)==0)
			{
				a[i].s1=math;
				a[i].s2=english;
				a[i].s3=computer;
				printf("Update success\n");
				return(persons);
			}
		} 
		printf("Students do not exist\n");
		return(persons);
	}
	else if(order==4)
	{
		scanf("%s",midid);
		for(int i=0;i<persons;i++)
		{
			if(strcmp(a[i].id,midid)==0)
			{
				average=(a[i].s1+a[i].s2+a[i].s3)/3.0;
				printf("Student ID:%s\nName:%s\nAverage Score:%.1lf\n",a[i].id,a[i].name,average);
				return(persons);
			}
		}
		printf("Students do not exist\n");
		return(persons);
	}
}
